﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace Ord
{
    class Gl
    {
        public static Random rnd = new Random();

        // создать колоду
        public static List<Card> CreatePack(int n5, int n4, int n3, int n2, int n1)
        {
            List<Card> pack = new List<Card>();

            // заполняем колоду
            // все
            for (int i = 0; i < n5; i++)
            {
                pack.Add(new Card(1, 1, 1, 1, 1));
            }
            // 4
            for (int i = 0; i < n4; i++)
            {
                pack.Add(new Card(0, 1, 1, 1, 1));
                pack.Add(new Card(1, 0, 1, 1, 1));
                pack.Add(new Card(1, 1, 0, 1, 1));
                pack.Add(new Card(1, 1, 1, 0, 1));
                pack.Add(new Card(1, 1, 1, 1, 0));
            }
            // 3
            for (int i = 0; i < n3; i++)
            {
                pack.Add(new Card(0, 0, 1, 1, 1));
                pack.Add(new Card(1, 0, 0, 1, 1));
                pack.Add(new Card(1, 1, 0, 0, 1));
                pack.Add(new Card(1, 1, 1, 0, 0));
                pack.Add(new Card(0, 1, 0, 1, 1));
                pack.Add(new Card(1, 0, 1, 0, 1));
                pack.Add(new Card(1, 1, 0, 1, 0));
                pack.Add(new Card(0, 1, 1, 0, 1));
                pack.Add(new Card(1, 0, 1, 1, 0));
                pack.Add(new Card(0, 1, 1, 1, 0));
            }
            // 2
            for (int i = 0; i < n2; i++)
            {
                pack.Add(new Card(1, 1, 0, 0, 0));
                pack.Add(new Card(0, 1, 1, 0, 0));
                pack.Add(new Card(0, 0, 1, 1, 0));
                pack.Add(new Card(0, 0, 0, 1, 1));
                pack.Add(new Card(1, 0, 1, 0, 0));
                pack.Add(new Card(0, 1, 0, 1, 0));
                pack.Add(new Card(0, 0, 1, 0, 1));
                pack.Add(new Card(1, 0, 0, 1, 0));
                pack.Add(new Card(0, 1, 0, 0, 1));
                pack.Add(new Card(1, 0, 0, 0, 1));
            }
            // 1
            for (int i = 0; i < n1; i++)
            {
                pack.Add(new Card(1, 0, 0, 0, 0));
                pack.Add(new Card(0, 1, 0, 0, 0));
                pack.Add(new Card(0, 0, 1, 0, 0));
                pack.Add(new Card(0, 0, 0, 1, 0));
                pack.Add(new Card(0, 0, 0, 0, 1));
            }
            return pack;
        }
        // перемешать
        public static void Shuffle(List<Card> pack)
        {
            for (int i = 0; i < 10000; i++)
            {
                int c1 = rnd.Next(pack.Count);
                int c2 = rnd.Next(pack.Count);
                Card c = pack[c1];
                pack[c1] = pack[c2];
                pack[c2] = c;
            }
        }
        // раздать
        public static void DealCards(List<Player> pl, List<Card> pack)
        {
            for (int p = 0; p < pl.Count; p++)
            {
                for (int i = 0; i < 5; i++)
                {
                    pl[p].card.Add(pack[0]);
                    pack.RemoveAt(0);
                }
            }
        }

    }

}
